<template>
  <list-con @goChitInfo="goChitInfo" :show-chit-info="true" :chit-data="chitData" :go-back-title="'返回保单列表'"
            @goBack="goBack" :add-go-back="true">
    <div v-if="isArr(dataList)">
      <detail-item :data-item="item" @goInfo="goInfo" v-for="(item,index) in dataList" :key="index"></detail-item>
    </div>
    <el-empty style="background: #fff;" v-else description="暂无数据"></el-empty>
  </list-con>
</template>

<script>
import {chitQueryMixins} from "@/views/chitLook/components/chitQuery/chitQueryMixins";
import {queryOrderDetailsById} from "@/api/chit/chitListPage";

export default {
  name: "detailList",
  mixins: [chitQueryMixins],
  props: {
    chitData: {
      type: Object
    }
  },
  data() {
    return {
      dataList: [],
      plotData: null
    }
  },
  watch: {
    chitData(val) {
      if (val == null || val == '') {
        this.dataList = []
      } else {
        this.getList()
      }
    }
  },
  methods: {
    getList() {
      this.startLoading('正在加载....')
      let owner = this;
      let {chitData, pageQueryParam} = this
      let param = {id: chitData.id}
      queryOrderDetailsById(param).then(res => {
        owner.dataList = res.data.orderDetailList
        owner.plotData = res.data.geoDataList
        owner.$emit('showPlot', res.data.geoDataList)
      }).finally(() => {
        owner.endLoading()
      })
    }
  }
}
</script>

<style scoped>

</style>
